package leecode

func findMaxConsecutiveOnes(nums []int) int {
	nums = append(nums, 0)
	//统计1的最大个数
	var maxCount int
	temp := 0 //中间变量,用来统计连续出现的1的个数
	for last := 0; last < len(nums); last++ {
		if nums[last] == 1 {
			temp++
		} else {
			if temp > maxCount {
				maxCount = temp
			}
			temp = 0
		}
	}
	return maxCount
}
